package {
	
	import devkit.commando.rpc.RPCGateway;
	
	import vo.GroupVO;
	import vo.UserVO;
	
	/**
	 * Class used to manage user session data.
	 * @author Francois Dempers
	 */
	public class Session {
		
		/** The unique session allocated to this user's session. */
		[Bindable] public static var sessionID:String;
		
		/** The session data of the user. */
		[Bindable] public static var userData:UserVO;
		
		/** The data of the group. */
		[Bindable] public static var groupData:GroupVO;
		
		/** The data of the group. */
		[Bindable] public static var modules:Array;
		
		/** The gateway which to run rpc commands through. */
		[Bindable] public static var rpcGateway:RPCGateway;
		
		/** The url to the general chat room. */
		[Bindable] public static var chatRoomURL:String;
		
		/**
		 * Logs to user onto the system.
		 * @param sessionKey The id allocated to the user's session.
		 * @param userInfo The user data for the session.
		 * @param userModules The modules that the user is allowed to access.
		 */
		public static function login(sessionKey:String, userInfo:UserVO, userModules:Array):void {
			
			sessionID = sessionKey;
			userData = userInfo;
			modules = userModules;
		}
		
		/** Logs the user off from the system. */
		public static function logout():void {
			
			sessionID = null;
			userData = null;
			modules = null;
		}
	}
}